﻿/* $RCSFile: ListItems.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/Design/ListItems.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:32  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AddonNice.CRMWrapper.Design
{
    /// <summary
    /// Used to fill Arralist with string-Guid values for settings items
	/// </summary>
    public  class CrmEntityListItem : IComparable
    {
        /// <summary>
        /// Ctor with string/int/string
        /// </summary>
       public CrmEntityListItem(string displayNm, int typeCd, string entityNm)
       {
           _displayName     =   displayNm;
           _typeCode        =   typeCd;
           _entityName      =   entityNm;
       }

		private string _displayName;
		public string displayName 
		{
			get 
			{
				return _displayName;
			}
			set 
			{
				_displayName = value;
			}
		}
   
          
		private int _typeCode;
		public int typeCode
		{
           get
           {
               return _typeCode;
           }
           set
           {
               _typeCode = value;
           }
		}
   	
		private string _entityName;
		public string entityName
		{
           get
           {
               return _entityName;
           }
           set
           {
               _entityName = value;
           }
        }

		public int CompareTo(object value) 
		{
            if ( value is CrmEntityListItem )
			    return displayName.CompareTo(((CrmEntityListItem)value).displayName);
            return -1;
		}
   }

	/// <summary>
	/// Used to fill Arralist with string/Guid values for settings items
	/// </summary>
   public  class CrmListItem : IComparable
   {
        /// <summary>
        /// Ctor with string/Guid
        /// </summary>
		public CrmListItem(string strname,Guid id) 
        {
				name = strname;
                ID = id;
				}

		private string _name;
		public string name 
		{
			get 
			{
				return _name;
			}
			set 
			{
				_name = value;
			}
		}
   
          
		private Guid _ID;
		public Guid ID
		{
           get
           {
               return _ID;
           }
           set
           {
               _ID = value;
           }
		}
   	
		public int CompareTo(object value) 
		{
            if ( value is CrmListItem )
			    return name.CompareTo(((CrmListItem)value).name);
            return -1;
		}
	}
	
	/// <summary>
	/// Used to fill Arralist with string/int values for settings items
	/// </summary>
	public class CrmListInt : IComparable 
	{
		string _name    =	string.Empty;
		int _val		=	0;

        public string name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
            }
        }

		public int val	
        {
            get
            {
                return _val;
            }
            set
            {
                _val = value;
            }
        }

        public CrmListInt(string n, int v)
		{
			name    =	n;
			val     =	v;
		}

		public int CompareTo(object value) 
		{
            if ( value is CrmListInt )
			    return name.CompareTo(((CrmListInt)value).name);
            return -1;
		}
	}
}
